
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>ES6-ES11 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Landen">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-image-captions/image-captions.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="ES6.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../01html/html简介.html">
            
                <a href="../01html/html简介.html">
            
                    
                    HTML
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../01html/01html.html">
            
                <a href="../01html/01html.html">
            
                    
                    a链接、图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../01html/02html.html">
            
                <a href="../01html/02html.html">
            
                    
                    列表、表格、表单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../01html/h5新增.html">
            
                <a href="../01html/h5新增.html">
            
                    
                    h5新增
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../02css/css简介.html">
            
                <a href="../02css/css简介.html">
            
                    
                    CSS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../02css/居中、省略、清浮.html">
            
                <a href="../02css/居中、省略、清浮.html">
            
                    
                    居中、省略、清浮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../02css/浮动和定位.html">
            
                <a href="../02css/浮动和定位.html">
            
                    
                    浮动和定位
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../02css/变换、过渡、动画.html">
            
                <a href="../02css/变换、过渡、动画.html">
            
                    
                    变换、过渡、动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../02css/sass和rem.html">
            
                <a href="../02css/sass和rem.html">
            
                    
                    sass和rem
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../02css/flex、media、栅格化.html">
            
                <a href="../02css/flex、media、栅格化.html">
            
                    
                    flex、media、栅格化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="js简介.html">
            
                <a href="js简介.html">
            
                    
                    JavaScript
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="数据类型.html">
            
                <a href="数据类型.html">
            
                    
                    数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="字符串.html">
            
                <a href="字符串.html">
            
                    
                    字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="数组.html">
            
                <a href="数组.html">
            
                    
                    数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="回流和重绘.html">
            
                <a href="回流和重绘.html">
            
                    
                    回流和重绘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="浏览器的渲染过程.html">
            
                <a href="浏览器的渲染过程.html">
            
                    
                    浏览器的渲染过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="十大排序算法.html">
            
                <a href="十大排序算法.html">
            
                    
                    十大排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="对象的构建.html">
            
                <a href="对象的构建.html">
            
                    
                    对象的构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="this.html">
            
                <a href="this.html">
            
                    
                    this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="bind&call&apply.html">
            
                <a href="bind&call&apply.html">
            
                    
                    bind&call&apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="函数.html">
            
                <a href="函数.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="变量提升.html">
            
                <a href="变量提升.html">
            
                    
                    变量提升
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="作用域.html">
            
                <a href="作用域.html">
            
                    
                    作用域
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="对象.html">
            
                <a href="对象.html">
            
                    
                    对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="存储.html">
            
                <a href="存储.html">
            
                    
                    存储
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.15" data-path="事件.html">
            
                <a href="事件.html">
            
                    
                    事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.16" data-path="图片预览.html">
            
                <a href="图片预览.html">
            
                    
                    图片预览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.17" data-path="防抖节流.html">
            
                <a href="防抖节流.html">
            
                    
                    防抖节流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.18" data-path="同步异步.html">
            
                <a href="同步异步.html">
            
                    
                    同步异步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.19" data-path="babel入门.html">
            
                <a href="babel入门.html">
            
                    
                    babel入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.20" data-path="nvm.html">
            
                <a href="nvm.html">
            
                    
                    nvm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.21" data-path="ES6.html">
            
                <a href="ES6.html">
            
                    
                    ES6
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.22" data-path="ES6-ES11.html">
            
                <a href="ES6-ES11.html">
            
                    
                    ES6-ES11
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >ES6-ES11</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
                                <section class="normal markdown-section">
                                
                                <h1 id="es6-es11-&#x65B0;&#x589E;&#x7684;&#x7279;&#x6027;">ES6-ES11 &#x65B0;&#x589E;&#x7684;&#x7279;&#x6027;</h1>
<h2 id="es6">ES6</h2>
<h3 id="&#x4E00;-let">&#x4E00;. let</h3>
<ol>
<li>&#x53D8;&#x91CF;&#x4E0D;&#x80FD;&#x91CD;&#x590D;&#x58F0;&#x660E;</li>
<li>&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;</li>
<li>&#x4E0D;&#x5B58;&#x5728;&#x53D8;&#x91CF;&#x63D0;&#x5347;</li>
<li>&#x4E0D;&#x5F71;&#x54CD;&#x4F5C;&#x7528;&#x57DF;&#x94FE;</li>
</ol>
<h3 id="&#x4E8C;-const">&#x4E8C;. const</h3>
<ol>
<li>&#x4E00;&#x5B9A;&#x8981;&#x8D4B;&#x521D;&#x59CB;&#x503C;</li>
<li>&#x4E00;&#x822C;&#x5E38;&#x91CF;&#x4F7F;&#x7528;&#x5927;&#x5199;(&#x6F5C;&#x89C4;&#x5219;)</li>
<li>&#x5E38;&#x91CF;&#x7684;&#x503C;&#x4E0D;&#x80FD;&#x4FEE;&#x6539;</li>
<li>&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;</li>
<li>&#x5BF9;&#x4E8E;&#x6570;&#x7EC4;&#x548C;&#x5BF9;&#x8C61;&#x7684;&#x5143;&#x7D20;&#x4FEE;&#x6539;&#xFF0C;&#x4E0D;&#x7B97;&#x505A;&#x5BF9;&#x5E38;&#x91CF;&#x7684;&#x4FEE;&#x6539;&#xFF0C;&#x4E0D;&#x4F1A;&#x62A5;&#x9519;</li>
</ol>
<h3 id="&#x4E09;-&#x89E3;&#x6784;&#x8D4B;&#x503C;">&#x4E09;. &#x89E3;&#x6784;&#x8D4B;&#x503C;</h3>
<ol>
<li>&#x6570;&#x7EC4;&#x4F7F;&#x7528;[],&#x5BF9;&#x8C61;&#x4F7F;&#x7528;{}</li>
</ol>
<h3 id="&#x56DB;-&#x6A21;&#x677F;&#x5B57;&#x7B26;&#x4E32;">&#x56DB;. &#x6A21;&#x677F;&#x5B57;&#x7B26;&#x4E32;</h3>
<ol>
<li>&#x5185;&#x5BB9;&#x4E2D;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x51FA;&#x73B0;&#x6362;&#x884C;&#x7B26;</li>
<li>&#x53D8;&#x91CF;&#x62FC;&#x63A5;</li>
</ol>
<h3 id="&#x4E94;-&#x7B80;&#x5316;&#x5BF9;&#x8C61;&#x5199;&#x6CD5;">&#x4E94;. &#x7B80;&#x5316;&#x5BF9;&#x8C61;&#x5199;&#x6CD5;</h3>
<ol>
<li>&#x5141;&#x8BB8;&#x5728;&#x5927;&#x62EC;&#x53F7;&#x91CC;&#x9762;&#xFF0C;&#x76F4;&#x63A5;&#x5199;&#x5165;&#x53D8;&#x91CF;&#x548C;&#x51FD;&#x6570;&#xFF0C;&#x4F5C;&#x4E3A;&#x5BF9;&#x8C61;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;</li>
</ol>
<h3 id="&#x516D;-&#x7BAD;&#x5934;&#x51FD;&#x6570;">&#x516D;. &#x7BAD;&#x5934;&#x51FD;&#x6570;</h3>
<ol>
<li>this&#x662F;&#x9759;&#x6001;&#x7684;&#xFF0C;this&#x59CB;&#x7EC8;&#x6307;&#x5411;&#x51FD;&#x6570;&#x58F0;&#x660E;&#x65F6;&#x6240;&#x5728;&#x4F5C;&#x7528;&#x57DF;&#x4E0B;&#x7684;this&#x7684;&#x503C;</li>
<li>&#x4E0D;&#x80FD;&#x4F5C;&#x4E3A;&#x6784;&#x9020;&#x5B9E;&#x4F8B;&#x5316;&#x5BF9;&#x8C61;</li>
<li>&#x4E0D;&#x80FD;&#x4F7F;&#x7528;arguments&#x53D8;&#x91CF;</li>
<li>&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x7684;&#x7B80;&#x5199;<ul>
<li>&#x7701;&#x7565;&#x5C0F;&#x62EC;&#x53F7;&#xFF0C;&#x5F53;&#x5F62;&#x53C2;&#x6709;&#x4E14;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x7684;&#x65F6;&#x5019;</li>
<li>&#x7701;&#x7565;&#x82B1;&#x62EC;&#x53F7;&#xFF0C;&#x5F53;&#x4EE3;&#x7801;&#x4F53;&#x53EA;&#x6709;&#x4E00;&#x6761;&#x8BED;&#x53E5;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6B64;&#x65F6;return&#x5FC5;&#x987B;&#x7701;&#x7565;&#xFF0C;&#x800C;&#x4E14;&#x8BED;&#x53E5;&#x7684;&#x6267;&#x884C;&#x7ED3;&#x679C;&#x5C31;&#x662F;&#x51FD;&#x6570;&#x7684;&#x8FD4;&#x56DE;&#x503C;</li>
</ul>
</li>
</ol>
<blockquote>
<p>&#x4F7F;&#x7528;&#x573A;&#x666F;&#xFF1A;&#x9002;&#x5408;&#x4E0E;this&#x65E0;&#x5173;&#x7684;&#x56DE;&#x8C03;&#xFF1A;&#x5B9A;&#x65F6;&#x5668;&#xFF0C;&#x6570;&#x7EC4;&#x7684;&#x65B9;&#x6CD5;&#x56DE;&#x8C03;&#xFF1B;&#x4E0D;&#x9002;&#x5408;&#x4E8E;this&#x6709;&#x5173;&#x7684;&#x56DE;&#x8C03;&#xFF1A;&#x4E8B;&#x4EF6;&#x56DE;&#x8C03;&#xFF0C;&#x5BF9;&#x8C61;&#x7684;&#x65B9;&#x6CD5;</p>
</blockquote>
<h3 id="&#x4E03;-&#x5141;&#x8BB8;&#x7ED9;&#x51FD;&#x6570;&#x53C2;&#x6570;&#x8D4B;&#x503C;&#x521D;&#x59CB;&#x503C;">&#x4E03;. &#x5141;&#x8BB8;&#x7ED9;&#x51FD;&#x6570;&#x53C2;&#x6570;&#x8D4B;&#x503C;&#x521D;&#x59CB;&#x503C;</h3>
<ol>
<li>&#x5F62;&#x53C2;&#x521D;&#x59CB;&#x503C;&#xFF0C;&#x5177;&#x6709;&#x9ED8;&#x8BA4;&#x503C;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x4E00;&#x822C;&#x4F4D;&#x7F6E;&#x8981;&#x9760;&#x540E;(&#x6F5C;&#x89C4;&#x5219;)</li>
<li>&#x4E0E;&#x89E3;&#x6784;&#x8D4B;&#x503C;&#x7ED3;&#x5408;</li>
</ol>
<h3 id="&#x516B;-rest&#x53C2;&#x6570;">&#x516B;. rest&#x53C2;&#x6570;</h3>
<ol>
<li>&#x7528;&#x4E8E;&#x83B7;&#x53D6;&#x51FD;&#x6570;&#x7684;&#x5B9E;&#x53C2;&#xFF0C;&#x7528;&#x6765;&#x4EE3;&#x66FF;arguments</li>
<li>rest&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x8981;&#x653E;&#x5728;&#x53C2;&#x6570;&#x6700;&#x540E;</li>
</ol>
<h3 id="&#x4E5D;-&#x6269;&#x5C55;&#x8FD0;&#x7B97;&#x7B26;">&#x4E5D;. &#x6269;&#x5C55;&#x8FD0;&#x7B97;&#x7B26;</h3>
<ol>
<li>&#x80FD;&#x5C06;&#x6570;&#x7EC4;&#x8F6C;&#x6362;&#x4E3A;&#x9017;&#x53F7;&#x5206;&#x9694;&#x7684;&#x53C2;&#x6570;&#x5E8F;&#x5217;</li>
</ol>
<blockquote>
<p>&#x5E94;&#x7528;&#x573A;&#x666F;&#xFF1A;&#x6570;&#x7EC4;&#x7684;&#x5408;&#x5E76;&#xFF0C;&#x6570;&#x7EC4;&#x7684;&#x514B;&#x9686;(&#x6D45;&#x62F7;&#x8D1D;)&#xFF0C;&#x5C06;&#x4F2A;&#x6570;&#x7EC4;&#x8F6C;&#x6210;&#x771F;&#x6B63;&#x7684;&#x6570;&#x7EC4;</p>
</blockquote>
<h3 id="&#x5341;-symbol">&#x5341;. Symbol</h3>
<ul>
<li><p>&#x8868;&#x793A;&#x72EC;&#x4E00;&#x65E0;&#x4E8C;&#x7684;&#x503C;</p>
</li>
<li><p>&#x4E0D;&#x80FD;&#x4E0E;&#x5176;&#x4ED6;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x8FD0;&#x7B97;</p>
</li>
</ul>
<h3 id="&#x5341;&#x4E00;-&#x8FED;&#x4EE3;&#x5668;">&#x5341;&#x4E00;. &#x8FED;&#x4EE3;&#x5668;</h3>
<ul>
<li><p>&#x8FED;&#x4EE3;&#x5668;(Iterator)&#x662F;&#x4E00;&#x79CD;&#x63A5;&#x53E3;&#xFF0C;&#x4E3A;&#x5404;&#x79CD;&#x4E0D;&#x540C;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x63D0;&#x4F9B;&#x7EDF;&#x4E00;&#x7684;&#x8BBF;&#x95EE;&#x673A;&#x5236;&#x3002;&#x4EFB;&#x4F55;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x53EA;&#x8981;&#x90E8;&#x7F72;Iterator&#x63A5;&#x53E3;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x5B8C;&#x6210;&#x904D;&#x5386;&#x64CD;&#x4F5C;&#x3002;</p>
</li>
<li><p>ES6&#x521B;&#x5EFA;&#x4E86;&#x4E00;&#x79CD;&#x65B0;&#x7684;&#x904D;&#x5386;&#x547D;&#x4EE4;for...of&#x5FAA;&#x73AF;&#xFF0C;Iterator&#x63A5;&#x53E3;&#x4E3B;&#x8981;&#x4F9B;for...of&#x6D88;&#x8D39;</p>
</li>
<li>&#x539F;&#x751F;&#x5177;&#x5907;iterator&#x63A5;&#x53E3;&#x7684;&#x6570;&#x636E;(&#x53EF;&#x4EE5;for...of&#x904D;&#x5386;)<ul>
<li>Array</li>
<li>Arguments</li>
<li>Set</li>
<li>Map</li>
<li>String</li>
<li>TypeArray</li>
<li>NodeList</li>
</ul>
</li>
<li>&#x5DE5;&#x4F5C;&#x539F;&#x7406;<ul>
<li>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6307;&#x9488;&#x5BF9;&#x8C61;&#xFF0C;&#x6307;&#x5411;&#x5F53;&#x524D;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x7684;&#x8D77;&#x59CB;&#x4F4D;&#x7F6E;</li>
<li>&#x7B2C;&#x4E00;&#x6B21;&#x8C03;&#x7528;&#x5BF9;&#x8C61;&#x7684;next&#x65B9;&#x6CD5;&#xFF0C;&#x6307;&#x9488;&#x81EA;&#x52A8;&#x6307;&#x5411;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x6210;&#x5458;</li>
<li>&#x63A5;&#x4E0B;&#x6765;&#x4E0D;&#x65AD;&#x8C03;&#x7528;next&#x65B9;&#x6CD5;&#xFF0C;&#x6307;&#x9488;&#x4E00;&#x76F4;&#x5F80;&#x540E;&#x79FB;&#x52A8;&#xFF0C;&#x76F4;&#x5230;&#x6307;&#x5411;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x6210;&#x5458;</li>
<li>&#x6BCF;&#x8C03;&#x7528;next&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x5305;&#x542B;value&#x548C;done&#x5C5E;&#x6027;&#x7684;&#x5BF9;&#x8C61;</li>
</ul>
</li>
</ul>
<h3 id="&#x5341;&#x4E8C;-&#x751F;&#x6210;&#x5668;">&#x5341;&#x4E8C;. &#x751F;&#x6210;&#x5668;</h3>
<ul>
<li>&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x7684;&#x51FD;&#x6570;</li>
</ul>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> * <span class="hljs-title">gen</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">yield</span> <span class="hljs-string">&quot;111&quot;</span>;
    <span class="hljs-keyword">yield</span> <span class="hljs-string">&quot;222&quot;</span>;
    <span class="hljs-keyword">yield</span> <span class="hljs-string">&quot;333&quot;</span>;
}
<span class="hljs-keyword">let</span> iterator = gen();
iterator.next();
iterator.next();
iterator.next();
iterator.next();
</code></pre>
<h3 id="&#x5341;&#x4E09;-promise">&#x5341;&#x4E09;. promise</h3>
<h3 id="&#x5341;&#x56DB;-set&#x96C6;&#x5408;">&#x5341;&#x56DB;. Set(&#x96C6;&#x5408;)</h3>
<ul>
<li>&#x5B83;&#x7C7B;&#x4F3C;&#x4E8E;&#x6570;&#x7EC4;&#xFF0C;&#x4F46;&#x6210;&#x5458;&#x7684;&#x503C;&#x90FD;&#x662F;&#x552F;&#x4E00;&#x7684;&#xFF0C;&#x96C6;&#x5408;&#x5B9E;&#x73B0;&#x4E86;iterator&#x63A5;&#x53E3;&#xFF0C;&#x6240;&#x4EE5;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6269;&#x5C55;&#x8FD0;&#x7B97;&#x7B26;&#x548C;for...fo&#x8FDB;&#x884C;&#x904D;&#x5386;</li>
<li>&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#xFF1A;<ol>
<li>size: &#x8FD4;&#x56DE;&#x96C6;&#x5408;&#x7684;&#x5143;&#x7D20;&#x4E2A;&#x6570;</li>
<li>add: &#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x65B0;&#x5143;&#x7D20;&#xFF0C;&#x8FD4;&#x56DE;&#x5F53;&#x524D;&#x96C6;&#x5408;</li>
<li>delete: &#x5220;&#x9664;&#x5143;&#x7D20;&#xFF0C;&#x8FD4;&#x56DE;boolean&#x503C;</li>
<li>has: &#x68C0;&#x6D4B;&#x96C6;&#x5408;&#x4E2D;&#x662F;&#x5426;&#x5305;&#x542B;&#x67D0;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x8FD4;&#x56DE;boolean&#x503C;</li>
<li>clear: &#x6E05;&#x7A7A;&#x96C6;&#x5408;</li>
</ol>
</li>
</ul>
<h3 id="&#x5341;&#x4E94;-map">&#x5341;&#x4E94;. Map</h3>
<ul>
<li>&#x5B83;&#x7C7B;&#x4F3C;&#x4E8E;&#x5BF9;&#x8C61;&#xFF0C;&#x4E5F;&#x662F;&#x952E;&#x503C;&#x5BF9;&#x7684;&#x96C6;&#x5408;&#x3002;&#x4F46;&#x662F;&#x201C;&#x952E;&#x201D;&#x7684;&#x8303;&#x56F4;&#x4E0D;&#x9650;&#x4E8E;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5404;&#x79CD;&#x7C7B;&#x578B;&#x7684;&#x503C;(&#x5305;&#x62EC;&#x5BF9;&#x8C61;)&#x90FD;&#x53EF;&#x4EE5;&#x5F53;&#x4F5C;&#x952E;&#x3002;Map&#x4E5F;&#x5B9E;&#x73B0;&#x4E86;iterator&#x63A5;&#x53E3;&#xFF0C;&#x6240;&#x4EE5;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6269;&#x5C55;&#x8FD0;&#x7B97;&#x7B26;&#x548C;for...of&#x8FDB;&#x884C;&#x904D;&#x5386;</li>
<li>&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#xFF1A;<ol>
<li>size: &#x8FD4;&#x56DE;Map&#x7684;&#x5143;&#x7D20;&#x4E2A;&#x6570;</li>
<li>set: &#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x65B0;&#x5143;&#x7D20;&#xFF0C;&#x8FD4;&#x56DE;&#x5F53;&#x524D;Map</li>
<li>get: &#x8FD4;&#x56DE;&#x952E;&#x540D;&#x5BF9;&#x8C61;&#x7684;&#x952E;&#x503C;</li>
<li>has: &#x68C0;&#x6D4B;Map&#x4E2D;&#x662F;&#x5426;&#x5305;&#x542B;&#x67D0;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x8FD4;&#x56DE;boolean&#x503C;</li>
<li>clear: &#x6E05;&#x7A7A;&#x96C6;&#x5408;&#xFF0C;&#x8FD4;&#x56DE;undefined</li>
</ol>
</li>
</ul>
<h3 id="&#x5341;&#x516D;-class&#x7C7B;">&#x5341;&#x516D;. class&#x7C7B;</h3>
<ul>
<li>&#x901A;&#x8FC7;class&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x7C7B;&#x3002;&#x57FA;&#x672C;&#x4E0A;&#xFF0C;ES6&#x7684;class&#x53EF;&#x4EE5;&#x770B;&#x4F5C;&#x53EA;&#x662F;&#x4E00;&#x4E2A;&#x8BED;&#x6CD5;&#x7CD6;&#xFF0C;&#x5B83;&#x7684;&#x7EDD;&#x5927;&#x90E8;&#x5206;&#x529F;&#x80FD;&#xFF0C;ES5&#x90FD;&#x53EF;&#x4EE5;&#x505A;&#x5230;&#xFF0C;&#x65B0;&#x7684;class&#x5199;&#x6CD5;&#x53EA;&#x662F;&#x8BA9;&#x5BF9;&#x8C61;&#x539F;&#x578B;&#x7684;&#x5199;&#x6CD5;&#x66F4;&#x52A0;&#x6E05;&#xFF0C;&#x66F4;&#x50CF;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#x7684;&#x8BED;&#x6CD5;&#x800C;&#x5DF2;&#x3002;</li>
<li>&#x77E5;&#x8BC6;&#x70B9;&#xFF1A;<ol>
<li>class&#x58F0;&#x660E;&#x7C7B;</li>
<li>constructor&#x5B9A;&#x4E49;&#x6784;&#x9020;&#x51FD;&#x6570;&#x521D;&#x59CB;&#x5316;</li>
<li>extends&#x7EE7;&#x627F;&#x7236;&#x7C7B;</li>
<li>super&#x8C03;&#x7528;&#x7236;&#x7EA7;&#x6784;&#x9020;&#x65B9;&#x6CD5;</li>
<li>static&#x5B9A;&#x4E49;&#x9759;&#x6001;&#x65B9;&#x6CD5;&#x548C;&#x5C5E;&#x6027;</li>
<li>&#x7236;&#x7C7B;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x91CD;&#x5199;</li>
</ol>
</li>
</ul>
<h3 id="&#x5341;&#x4E03;-&#x6570;&#x503C;&#x6269;&#x5C55;">&#x5341;&#x4E03;. &#x6570;&#x503C;&#x6269;&#x5C55;</h3>
<ol>
<li>Number.EPSILON&#x662F;JavaScript&#x8868;&#x793A;&#x7684;&#x6700;&#x5C0F;&#x7CBE;&#x5EA6;<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">equal</span>(<span class="hljs-params">a, b</span>) </span>{
 <span class="hljs-keyword">if</span> (<span class="hljs-built_in">Math</span>.abs(a - b) &lt; <span class="hljs-built_in">Number</span>.EPSILON) {
   <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
 } <span class="hljs-keyword">else</span> {
   <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
 }
}
<span class="hljs-built_in">console</span>.log(<span class="hljs-number">0.1</span> + <span class="hljs-number">0.2</span> === <span class="hljs-number">0.3</span>); <span class="hljs-comment">// false </span>
<span class="hljs-built_in">console</span>.log(equal(<span class="hljs-number">0.1</span> + <span class="hljs-number">0.2</span>, <span class="hljs-number">0.3</span>)); <span class="hljs-comment">// true</span>
</code></pre>
</li>
<li>&#x4E8C;&#x8FDB;&#x5236;&#x548C;&#x516B;&#x8FDB;&#x5236;<pre><code class="lang-js"><span class="hljs-keyword">let</span> b = <span class="hljs-number">0b1010</span>; <span class="hljs-comment">// 0b&#x5F00;&#x5934;&#x4E8C;&#x8FDB;&#x5236;</span>
<span class="hljs-keyword">let</span> o = <span class="hljs-number">0o777</span>; <span class="hljs-comment">// 0o&#x5F00;&#x5934;&#x516B;&#x8FDB;&#x5236; 7*8*8+7*8+7*1</span>
<span class="hljs-keyword">let</span> x = <span class="hljs-number">0xff</span>; <span class="hljs-comment">// 0x&#x5F00;&#x5934;&#x5341;&#x516D;&#x8FDB;&#x5236; 15*16&#x7684;1&#x6B21;&#x65B9;+15*16&#x7684;0&#x6B21;&#x65B9;</span>
</code></pre>
</li>
<li>Number.isFinite &#x68C0;&#x6D4B;&#x4E00;&#x4E2A;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A;&#x6709;&#x9650;&#x6570;<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Number</span>.isFinite(<span class="hljs-number">100</span>)); <span class="hljs-comment">// true</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Number</span>.isFinite(<span class="hljs-number">100</span>/<span class="hljs-number">0</span>)); <span class="hljs-comment">// false</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Number</span>.isFinite(<span class="hljs-literal">Infinity</span>)); <span class="hljs-comment">// false</span>
</code></pre>
</li>
<li>Number.isNaN &#x68C0;&#x6D4B;&#x4E00;&#x4E2A;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A;NaN<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Number</span>.isNaN(<span class="hljs-number">123</span>)); <span class="hljs-comment">// false</span>
</code></pre>
</li>
<li>Number.parseInt,Number.parseFloat &#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x6574;&#x6570;</li>
<li>Number.isInteger &#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x6570;&#x662F;&#x5426;&#x4E3A;&#x6574;&#x6570;<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Number</span>.isInteger(<span class="hljs-number">5</span>)); <span class="hljs-comment">// true</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Number</span>.isInteger(<span class="hljs-number">2.5</span>)); <span class="hljs-comment">// false</span>
</code></pre>
</li>
<li>Math.trunc &#x5C06;&#x6570;&#x5B57;&#x7684;&#x5C0F;&#x6570;&#x90E8;&#x5206;&#x62B9;&#x6389;<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Math</span>.trunc(<span class="hljs-number">3.5</span>)); <span class="hljs-comment">// 3</span>
</code></pre>
</li>
<li>Math.sign &#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x6570;&#x5230;&#x5E95;&#x4E3A;&#x6B63;&#x6570; &#x8D1F;&#x6570; &#x8FD8;&#x662F;&#x96F6;<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Math</span>.sign(<span class="hljs-number">100</span>)); <span class="hljs-comment">// 1</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Math</span>.sign(<span class="hljs-number">0</span>)); <span class="hljs-comment">// 0</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Math</span>.sign(<span class="hljs-number">-100</span>)); <span class="hljs-comment">// -1</span>
</code></pre>
</li>
</ol>
<h3 id="&#x5341;&#x516B;-&#x5BF9;&#x8C61;&#x65B9;&#x6CD5;&#x6269;&#x5C55;">&#x5341;&#x516B;. &#x5BF9;&#x8C61;&#x65B9;&#x6CD5;&#x6269;&#x5C55;</h3>
<ol>
<li>Object.is &#x5224;&#x65AD;&#x4E24;&#x4E2A;&#x503C;&#x662F;&#x5426;&#x5B8C;&#x5168;&#x76F8;&#x7B49;<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Object</span>.is(<span class="hljs-number">120</span>,<span class="hljs-number">120</span>)); <span class="hljs-comment">// true</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Object</span>.is(<span class="hljs-literal">NaN</span>,<span class="hljs-literal">NaN</span>)); <span class="hljs-comment">// true</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-literal">NaN</span> === <span class="hljs-literal">NaN</span>); <span class="hljs-comment">// false</span>
</code></pre>
</li>
<li>Object.assign &#x5BF9;&#x8C61;&#x7684;&#x5408;&#x5E76;<pre><code class="lang-js"><span class="hljs-keyword">const</span> config1 = {
 host: <span class="hljs-string">&apos;localhost&apos;</span>,
 port: <span class="hljs-number">3306</span>,
 name: <span class="hljs-string">&apos;root&apos;</span>,
 pass: <span class="hljs-string">&apos;root&apos;</span>
}
<span class="hljs-keyword">const</span> config2 = {
 host: <span class="hljs-string">&apos;http://www.baidu.com&apos;</span>
}
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Object</span>.assign(config1,config2)); <span class="hljs-comment">// &#x540E;&#x9762;&#x53C2;&#x6570;&#x8986;&#x76D6;&#x524D;&#x9762;&#x53C2;&#x6570;</span>
</code></pre>
</li>
<li>Object.setPrototypeOf(&#x8BBE;&#x7F6E;&#x539F;&#x578B;&#x5BF9;&#x8C61;)  Object.getPrototypeOf<pre><code class="lang-js"><span class="hljs-keyword">const</span> school = {
 name: <span class="hljs-string">&apos;lin&apos;</span>
}
<span class="hljs-keyword">const</span> cities = {
 xiaoqu: [<span class="hljs-string">&apos;&#x5317;&#x4EAC;&apos;</span>,<span class="hljs-string">&apos;&#x4E0A;&#x6D77;&apos;</span>,<span class="hljs-string">&apos;&#x6DF1;&#x5733;&apos;</span>]
}
<span class="hljs-built_in">Object</span>.setPrototypeOf(school,cities);
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Object</span>.getPrototypeOf(school));
<span class="hljs-built_in">console</span>.log(school);
</code></pre>
</li>
</ol>
<h3 id="&#x5341;&#x4E5D;-&#x6A21;&#x5757;&#x5316;">&#x5341;&#x4E5D;. &#x6A21;&#x5757;&#x5316;</h3>
<ul>
<li>&#x6A21;&#x5757;&#x5316;&#x662F;&#x6307;&#x5C06;&#x4E00;&#x4E2A;&#x5927;&#x7684;&#x7A0B;&#x5E8F;&#x6587;&#x4EF6;&#xFF0C;&#x62C6;&#x5206;&#x6210;&#x8BB8;&#x591A;&#x5C0F;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x7136;&#x540E;&#x5C06;&#x5C0F;&#x6587;&#x4EF6;&#x7EC4;&#x5408;&#x8D77;&#x6765;</li>
<li>&#x597D;&#x5904;&#xFF1A;<ol>
<li>&#x9632;&#x6B62;&#x547D;&#x540D;&#x51B2;&#x7A81;</li>
<li>&#x4EE3;&#x7801;&#x590D;&#x7528;</li>
<li>&#x9AD8;&#x7EF4;&#x62A4;</li>
</ol>
</li>
<li>ES6&#x4E4B;&#x524D;&#x7684;&#x6A21;&#x5757;&#x5316;&#x89C4;&#x8303;&#x6709;&#xFF1A;<ol>
<li>CommonJS =&gt; NodeJS,Browserify</li>
<li>AMD =&gt; requireJS</li>
<li>CMD =&gt; seaJS</li>
</ol>
</li>
<li>ES6&#x6A21;&#x5757;&#x5316;&#x8BED;&#x6CD5;<ol>
<li>export&#x547D;&#x4EE4;&#x7528;&#x4E8E;&#x89C4;&#x5B9A;&#x6A21;&#x5757;&#x7684;&#x5BF9;&#x5916;&#x63A5;&#x53E3;</li>
<li>import&#x547D;&#x4EE4;&#x7528;&#x4E8E;&#x8F93;&#x5165;&#x5176;&#x4ED6;&#x6A21;&#x5757;&#x63D0;&#x4F9B;&#x7684;&#x529F;&#x80FD;</li>
</ol>
</li>
</ul>
<h3 id="&#x4E8C;&#x5341;-babel">&#x4E8C;&#x5341;. babel</h3>
<ol>
<li>&#x5B89;&#x88C5;&#x5DE5;&#x5177; npm install --save-dev @babel/core @babel/cli @babel/preset-env</li>
<li>&#x914D;&#x7F6E; .babelrc (babel&#x914D;&#x7F6E;&#x6587;&#x4EF6;)<pre><code class="lang-js">{
  <span class="hljs-string">&quot;presets&quot;</span>: [
      <span class="hljs-string">&quot;@babel/preset-env&quot;</span>
  ],
  <span class="hljs-string">&quot;plugins&quot;</span>: []
}
</code></pre>
</li>
<li>npx babel src -d dist</li>
</ol>
<h2 id="es7">ES7</h2>
<h3 id="&#x4E00;-arrayprototypeincludes">&#x4E00;. Array.prototype.includes</h3>
<ul>
<li>includes &#x65B9;&#x6CD5;&#x7528;&#x6765;&#x68C0;&#x6D4B;&#x6570;&#x7EC4;&#x4E2D;&#x662F;&#x5426;&#x5305;&#x542B;&#x67D0;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x8FD4;&#x56DE;&#x5E03;&#x5C14;&#x7C7B;&#x578B;&#x503C;</li>
</ul>
<h3 id="&#x4E8C;-&#x6307;&#x6570;&#x64CD;&#x4F5C;&#x7B26;">&#x4E8C;. &#x6307;&#x6570;&#x64CD;&#x4F5C;&#x7B26;</h3>
<ul>
<li>&#x6307;&#x6570;&#x8FD0;&#x7B97;&#x7B26;(**),&#x7528;&#x6765;&#x5B9E;&#x73B0;&#x5E42;&#x8FD0;&#x7B97;&#xFF0C;&#x529F;&#x80FD;&#x4E0E; Math.pow &#x7ED3;&#x679C;&#x76F8;&#x540C;</li>
</ul>
<h2 id="es8">ES8</h2>
<h3 id="&#x4E00;-async&#x548C;await">&#x4E00;. async&#x548C;await</h3>
<ul>
<li>&#x4E24;&#x79CD;&#x8BED;&#x6CD5;&#x7ED3;&#x5408;&#x53EF;&#x4EE5;&#x8BA9;&#x5F02;&#x6B65;&#x4EE3;&#x7801;&#x50CF;&#x540C;&#x6B65;&#x4EE3;&#x7801;&#x4E00;&#x6837;</li>
<li>async&#x51FD;&#x6570;<ol>
<li>async&#x51FD;&#x6570;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x4E3A;promise&#x5BF9;&#x8C61;</li>
<li>promise&#x5BF9;&#x8C61;&#x7684;&#x7ED3;&#x679C;&#x7531;async&#x51FD;&#x6570;&#x6267;&#x884C;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x51B3;&#x5B9A;</li>
</ol>
</li>
<li>await&#x8868;&#x8FBE;&#x5F0F;<ol>
<li>await&#x5FC5;&#x987B;&#x5199;&#x5728;async&#x51FD;&#x6570;&#x4E2D;</li>
<li>await&#x53F3;&#x4FA7;&#x7684;&#x8868;&#x8FBE;&#x5F0F;&#x4E00;&#x822C;&#x4E3A;promise&#x5BF9;&#x8C61;</li>
<li>await&#x8FD4;&#x56DE;&#x7684;&#x662F;promise&#x6210;&#x529F;&#x7684;&#x503C;</li>
<li>await&#x7684;promise&#x5931;&#x8D25;&#x4E86;&#xFF0C;&#x5C31;&#x4F1A;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#xFF0C;&#x9700;&#x8981;&#x901A;&#x8FC7;try...catch&#x6355;&#x83B7;&#x5904;&#x7406;</li>
</ol>
</li>
</ul>
<h3 id="&#x4E8C;-objectvalues&#x548C;objectentries">&#x4E8C;. Object.values&#x548C;Object.entries</h3>
<ol>
<li>Object.values() &#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x7ED9;&#x5B9A;&#x5BF9;&#x8C61;&#x7684;&#x6240;&#x6709;&#x53EF;&#x679A;&#x4E3E;&#x5C5E;&#x6027;&#x503C;&#x7684;&#x6570;&#x7EC4;</li>
<li>Object.entries() &#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x7ED9;&#x5B9A;&#x5BF9;&#x8C61;&#x81EA;&#x8EAB;&#x53EF;&#x904D;&#x5386;&#x5C5E;&#x6027;[key,value]&#x7684;&#x6570;&#x7EC4;</li>
</ol>
<h3 id="&#x4E09;-objectgetownpropertydescriptors">&#x4E09;. Object.getOwnPropertyDescriptors</h3>
<ul>
<li>&#x8BE5;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x6307;&#x5B9A;&#x5BF9;&#x8C61;&#x6240;&#x5728;&#x81EA;&#x8EAB;&#x5C5E;&#x6027;&#x7684;&#x63CF;&#x8FF0;&#x5BF9;&#x8C61;</li>
</ul>
<h2 id="es9">ES9</h2>
<h3 id="&#x4E00;-rest">&#x4E00;. rest</h3>
<ul>
<li>rest&#x53C2;&#x6570;&#x4E0E;spread&#x6269;&#x5C55;&#x8FD0;&#x7B97;&#x7B26;&#x5728;ES6&#x4E2D;&#x5DF2;&#x7ECF;&#x5F15;&#x5165;&#xFF0C;&#x4E0D;&#x8FC7;ES6&#x4E2D;&#x53EA;&#x9488;&#x5BF9;&#x4E8E;&#x6570;&#x7EC4;&#xFF0C;&#x5728;ES9&#x4E2D;&#x4E3A;&#x5BF9;&#x8C61;&#x63D0;&#x4F9B;&#x4E86;&#x50CF;&#x6570;&#x7EC4;&#x4E00;&#x6837;&#x7684;rest&#x53C2;&#x6570;&#x548C;&#x6269;&#x5C55;&#x8FD0;&#x7B97;&#x7B26;</li>
</ul>
<h3 id="&#x4E8C;-&#x6B63;&#x5219;&#x6269;&#x5C55;">&#x4E8C;. &#x6B63;&#x5219;&#x6269;&#x5C55;</h3>
<ol>
<li>&#x547D;&#x540D;&#x6355;&#x83B7;&#x5206;&#x7EC4;<pre><code class="lang-js"><span class="hljs-comment">// &#x4E4B;&#x524D;</span>
<span class="hljs-keyword">let</span> str = <span class="hljs-string">&apos;&lt;a href=&quot;http://www.baidu.com&quot;&gt;&#x767E;&#x5EA6;&lt;/a&gt;&apos;</span>;
<span class="hljs-comment">// &#x63D0;&#x53D6;url&#x4E0E;&#x6807;&#x7B7E;&#x6587;&#x672C;</span>
<span class="hljs-keyword">const</span> reg = <span class="hljs-regexp">/&lt;a href=&quot;(.*)&quot;&gt;(.*)&lt;\/a&gt;/</span>;
<span class="hljs-comment">// &#x6267;&#x884C;</span>
<span class="hljs-keyword">const</span> result = reg.exec(str);
<span class="hljs-built_in">console</span>.log(result[<span class="hljs-number">1</span>]); <span class="hljs-comment">// http://www.baidu.com</span>
<span class="hljs-built_in">console</span>.log(result[<span class="hljs-number">2</span>]); <span class="hljs-comment">// &#x767E;&#x5EA6;</span>
<span class="hljs-comment">// &#x4E4B;&#x540E;</span>
<span class="hljs-keyword">let</span> str = <span class="hljs-string">&apos;&lt;a href=&quot;http://www.baidu.com&quot;&gt;&#x767E;&#x5EA6;&lt;/a&gt;&apos;</span>;
<span class="hljs-keyword">const</span> reg = <span class="hljs-regexp">/&lt;a href=&quot;(?&lt;url&gt;.*)&quot;&gt;(?&lt;text&gt;.*)&lt;\/a&gt;/</span>;
<span class="hljs-keyword">const</span> result = reg.exec(str);
<span class="hljs-built_in">console</span>.log(result.groups.url);
<span class="hljs-built_in">console</span>.log(result.groups.text);
</code></pre>
</li>
<li>&#x53CD;&#x5411;&#x65AD;&#x8A00;<pre><code class="lang-js"><span class="hljs-keyword">let</span> str = <span class="hljs-string">&apos;JS23423984&#x4F60;&#x77E5;&#x9053;&#x4E48;555&#x5566;&#x5566;&#x5566;&apos;</span>;
<span class="hljs-comment">// &#x6B63;&#x5411;&#x65AD;&#x8A00;</span>
<span class="hljs-keyword">const</span> reg = <span class="hljs-regexp">/\d+(?=&#x5566;)/</span>;
<span class="hljs-keyword">const</span> result = reg.exec(str);
<span class="hljs-built_in">console</span>.log(result[<span class="hljs-number">0</span>]); <span class="hljs-comment">// 555</span>
<span class="hljs-comment">// &#x53CD;&#x5411;&#x65AD;&#x8A00;</span>
<span class="hljs-keyword">const</span> reg = <span class="hljs-regexp">/(?&lt;=&#x4E48;)\d+/</span>;
<span class="hljs-keyword">const</span> result = reg.exec(str);
<span class="hljs-built_in">console</span>.log(result[<span class="hljs-number">0</span>]); <span class="hljs-comment">// 555</span>
</code></pre>
</li>
<li>dotAll&#x6A21;&#x5F0F;</li>
</ol>
<pre><code class="lang-js"><span class="hljs-comment">// dot . &#x5143;&#x5B57;&#x7B26; &#x9664;&#x6362;&#x884C;&#x7B26;&#x4EE5;&#x5916;&#x7684;&#x4EFB;&#x610F;&#x5355;&#x4E2A;&#x5B57;&#x7B26;</span>
<span class="hljs-keyword">let</span> str = <span class="hljs-string">`
&lt;ul&gt;
    &lt;li&gt;
        &lt;a&gt;&#x8096;&#x7533;&#x514B;&#x7684;&#x6551;&#x8D4E;&lt;/a&gt;
        &lt;p&gt;&#x4E0A;&#x6620;&#x65F6;&#x95F4;: 1994-09-10&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;a&gt;&#x963F;&#x7518;&#x6B63;&#x4F20;&lt;/a&gt;
        &lt;p&gt;&#x4E0A;&#x6620;&#x65F6;&#x95F4;: 1994-09-10&lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;
`</span>;
<span class="hljs-keyword">const</span> reg = <span class="hljs-regexp">/&lt;li&gt;\s+&lt;a&gt;(.*?)&lt;\/a&gt;\s+&lt;p&gt;(.*?)&lt;\/p&gt;/</span>; <span class="hljs-comment">// \s&#x7528;&#x6765;&#x5339;&#x914D;&#x6362;&#x884C;&#x7B26;</span>
<span class="hljs-keyword">const</span> reg = <span class="hljs-regexp">/&lt;li&gt;.*?&lt;a&gt;(.*?)&lt;\/a&gt;.*?&lt;p&gt;(.*?)&lt;\/p&gt;/</span>s; <span class="hljs-comment">// .*?&#x65AD;&#x8A00;&#x5F00;&#x6765;</span>
<span class="hljs-keyword">const</span> result = reg.exec(str);
</code></pre>
<h2 id="es10">ES10</h2>
<h3 id="&#x4E00;-objectfromentries">&#x4E00;. Object.fromEntries</h3>
<ul>
<li>&#x7528;&#x6765;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x63A5;&#x6536;&#x4E00;&#x4E2A;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x6216;Map<pre><code class="lang-js"><span class="hljs-comment">// &#x4E8C;&#x7EF4;&#x6570;&#x7EC4;</span>
<span class="hljs-keyword">const</span> result = <span class="hljs-built_in">Object</span>.fromEntries([
  [<span class="hljs-string">&apos;name&apos;</span>,<span class="hljs-string">&apos;&#x6797;&apos;</span>],
  [<span class="hljs-string">&apos;xueke&apos;</span>,<span class="hljs-string">&apos;Java,&#x5927;&#x6570;&#x636E;,&#x524D;&#x7AEF;,&#x4E91;&#x8BA1;&#x7B97;&apos;</span>]
])
<span class="hljs-comment">// Map</span>
<span class="hljs-keyword">const</span> m = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();
m.set(<span class="hljs-string">&quot;name&quot;</span>,<span class="hljs-string">&quot;&#x6797;&quot;</span>);
<span class="hljs-keyword">const</span> result = <span class="hljs-built_in">Object</span>.fromEntries(m);
</code></pre>
</li>
</ul>
<h3 id="&#x4E8C;-trimstart&#x4E0E;trimend">&#x4E8C;. trimStart&#x4E0E;trimEnd</h3>
<ul>
<li>trimStart(): &#x6E05;&#x9664;&#x5DE6;&#x4FA7;&#x7A7A;&#x767D;&#x5B57;&#x7B26;</li>
<li>trimEnd(): &#x6E05;&#x9664;&#x53F3;&#x4FA7;&#x7A7A;&#x767D;&#x5B57;&#x7B26;</li>
</ul>
<h3 id="&#x4E09;-flat&#x4E0E;flatmap">&#x4E09;. flat&#x4E0E;flatMap</h3>
<ul>
<li>flat(): &#x5C06;&#x591A;&#x7EF4;&#x6570;&#x7EC4;&#x8F6C;&#x6362;&#x4E3A;&#x4F4E;&#x4F4D;&#x6570;&#x7EC4;&#xFF0C;&#x53C2;&#x6570;&#x4E3A;&#x6DF1;&#x5EA6;&#xFF0C;&#x662F;&#x4E00;&#x4E2A;&#x6570;&#x5B57;</li>
<li>flatMap(): flat&#x548C;map&#x7684;&#x4E00;&#x4E2A;&#x7ED3;&#x5408;&#xFF0C;&#x5C06;&#x904D;&#x5386;&#x5B8C;&#x7684;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x8F6C;&#x6362;&#x4E3A;&#x4E00;&#x7EF4;</li>
</ul>
<h3 id="&#x56DB;-symbolprototypedescription">&#x56DB;. Symbol.prototype.description</h3>
<pre><code class="lang-js"><span class="hljs-keyword">let</span> s = <span class="hljs-built_in">Symbol</span>(<span class="hljs-string">&quot;lin&quot;</span>);
<span class="hljs-built_in">console</span>.log(s.description);
</code></pre>
<h2 id="es11">ES11</h2>
<h3 id="&#x4E00;-&#x79C1;&#x6709;&#x5C5E;&#x6027;">&#x4E00;. &#x79C1;&#x6709;&#x5C5E;&#x6027;</h3>
<pre><code class="lang-js">class Person{
    // &#x516C;&#x6709;&#x5C5E;&#x6027;
    name;
    // &#x79C1;&#x6709;&#x5C5E;&#x6027;
    #age;
    #weight;
    // &#x6784;&#x9020;&#x65B9;&#x6CD5;
    constructor(name, age, weight){
        this.name = name;
        this.#age = age;
        this.#weight = weight;
    }
    intro(){
        console.log(this.name);
        console.log(this.#age); // &#x53EA;&#x80FD;&#x5728;&#x7C7B;&#x4E2D;&#x8BBF;&#x95EE;
        console.log(this.#weight);
    }
}
// &#x5B9E;&#x4F8B;&#x5316;
const girl = new Person(&quot;&#x6DA6;&quot;, 19, &quot;80kg&quot;);
console.log(girl);
</code></pre>
<h3 id="&#x4E8C;-promiseallsettled">&#x4E8C;. Promise.allSettled</h3>
<ul>
<li>&#x63A5;&#x6536;&#x591A;&#x4E2A;promise,&#x59CB;&#x7EC8;&#x8FD4;&#x56DE;&#x6210;&#x529F;&#x72B6;&#x6001;</li>
</ul>
<h3 id="&#x4E09;-stringprototypematchall">&#x4E09;. String.prototype.matchAll</h3>
<ul>
<li>&#x6279;&#x91CF;&#x5339;&#x914D;&#x6B63;&#x5219;&#x8868;&#x8FBE;&#x5F0F;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x636E;</li>
</ul>
<h3 id="&#x56DB;-&#x53EF;&#x9009;&#x94FE;&#x64CD;&#x4F5C;&#x7B26;">&#x56DB;. &#x53EF;&#x9009;&#x94FE;&#x64CD;&#x4F5C;&#x7B26;</h3>
<pre><code class="lang-js"><span class="hljs-comment">// ?.</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params">config</span>)</span>{
    <span class="hljs-comment">// const dbHost = config &amp;&amp; config.db &amp;&amp; config.db.host;</span>
    <span class="hljs-keyword">const</span> dbHost = config?.db?.host;

    <span class="hljs-built_in">console</span>.log(dbHost);
}
main({
    db: {
        host: <span class="hljs-string">&apos;192.168.1.100&apos;</span>,
        username: <span class="hljs-string">&apos;root&apos;</span>
    }
})
</code></pre>
<h3 id="&#x4E94;-&#x52A8;&#x6001;import&#x52A0;&#x8F7D;">&#x4E94;. &#x52A8;&#x6001;import&#x52A0;&#x8F7D;</h3>
<pre><code class="lang-js"><span class="hljs-comment">// import * as m1 from &quot;./hello.js&quot;;</span>
<span class="hljs-keyword">const</span> btn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">&quot;btn&quot;</span>);
btn.onclick = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">import</span>(<span class="hljs-string">&quot;./hello.js&quot;</span>).then(<span class="hljs-built_in">module</span> =&gt; {
        <span class="hljs-built_in">module</span>.hello();
    })
}
</code></pre>
<h3 id="&#x516D;-bigint">&#x516D;. BigInt</h3>
<pre><code class="lang-js"><span class="hljs-comment">// &#x5927;&#x6574;&#x5F62;</span>
<span class="hljs-keyword">let</span> n = <span class="hljs-number">521</span>n;
<span class="hljs-built_in">console</span>.log(n, <span class="hljs-keyword">typeof</span>(n)); <span class="hljs-comment">// 521n &quot;bigint&quot;</span>
<span class="hljs-comment">// &#x51FD;&#x6570;</span>
<span class="hljs-keyword">let</span> n = <span class="hljs-number">123</span>;
<span class="hljs-built_in">console</span>.log(BigInt(n)); <span class="hljs-comment">// 123n</span>
<span class="hljs-built_in">console</span>.log(BigInt(<span class="hljs-number">1.2</span>)); <span class="hljs-comment">// &#x62A5;&#x9519;</span>
<span class="hljs-comment">// &#x5927;&#x6570;&#x503C;&#x8FD0;&#x7B97;</span>
<span class="hljs-keyword">let</span> max = <span class="hljs-built_in">Number</span>.MAX_SAFE_INTEGER;
<span class="hljs-built_in">console</span>.log(max);
<span class="hljs-built_in">console</span>.log(max + <span class="hljs-number">1</span>);
<span class="hljs-built_in">console</span>.log(max + <span class="hljs-number">2</span>); <span class="hljs-comment">// &#x518D;&#x52A0;&#x5C31;&#x4F1A;&#x62A5;&#x9519;</span>

<span class="hljs-built_in">console</span>.log(BigInt(max));
<span class="hljs-built_in">console</span>.log(BigInt(max) + BigInt(<span class="hljs-number">1</span>));
<span class="hljs-built_in">console</span>.log(BigInt(max) + BigInt(<span class="hljs-number">2</span>)); <span class="hljs-comment">// &#x53EF;&#x4EE5;&#x4E00;&#x76F4;&#x52A0;&#x4E0B;&#x53BB;&#xB7;</span>
</code></pre>
<h3 id="&#x4E03;-globalthis">&#x4E03;. globalThis</h3>
<ul>
<li>&#x59CB;&#x7EC8;&#x6307;&#x5411;&#x5168;&#x5C40;&#x5BF9;&#x8C61;(&#x6D4F;&#x89C8;&#x5668;,node...)</li>
</ul>

                                
                                </section>
                            
                        </div>
                    </div>
                
            </div>

            
                
                <a href="ES6.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: ES6">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"ES6-ES11","level":"1.4.22","depth":2,"previous":{"title":"ES6","level":"1.4.21","depth":2,"path":"md/03js/ES6.md","ref":"./md/03js/ES6.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","-sharing","toggle-chapters","image-captions","-anchor-navigation","-anchor-navigation-ex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"image-captions":{"attributes":{"style":"left: 50%;position: relative;transform: translateX(-50%);"},"caption":"图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_","align":"center","variable_name":"_pictures"},"fontsettings":{"theme":"night","family":"sans","size":2},"toggle-chapters":{},"highlight":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Landen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"_pictures":[]},"gitbook":"3.x.x"},"file":{"path":"md/03js/ES6-ES11.md","mtime":"2020-08-15T09:05:45.126Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-08-17T10:41:18.504Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

